const { ccclass, property } = cc._decorator;

@ccclass
export default class UIEffect extends cc.Component {
    onLoad() {
        this.UIEffectInit()
    }
    onDestroy() {
    }
    onEnable() { }
    onDisable() {
        this.UIEffectDisable(null);
    }

    UIEffectInit() {
        var act = this.init();
        this.node.stopAllActions();
        
        this.node.runAction(act);
    }

    init() {
        return null;
    }

    UIEffectDisable(parent) {
        var act = this.disable();
        var actSequence = cc.sequence(act, cc.callFunc(function () { if (parent) parent.active = false; }.bind(this)));
        this.node.stopAllActions();
        this.node.runAction(actSequence);
    }

    disable() {
        return null;
    }
}

